$(function() {
    var flag = false;
    $("#sign").bind("click", function() {
        var url = "api_sign";
        if (flag) {
            return;
        }
        flag = true;
        $.post(url, {
            match_id: $("body").attr("data-id")
        }, function(data) {
            if (data.state == 200) {
                $("#sign").text("待审核");
                $("#sign").unbind("click");
                alert("请下载附件，并到个人中心查看赛事，上传报名表。");
                window.location.href="user/myhome.html";
            } else {
                flag = false;
                alert(data.comment);
                if(data.goPage){
                	window.location.href=data.goPage;
                }
                return;
            }
        }, "json");
    })
})

